﻿using System.Collections;
using System.Collections.Generic;
using Game.Data;
using UnityEngine;


namespace Game
{
    /// <summary>
    /// 单例类，创建 元素
    /// </summary>
    public class CreatorService
    {

        #region 单例

        private static CreatorService instance;

        public static CreatorService Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new CreatorService();
                }
                return instance;
            }
        }

        #endregion

        #region Filed

        private Contexts contexts;

        #endregion

        #region Public Method

        public void Init(Contexts contexts)
        {
            this.contexts = contexts;
        }

        /// <summary>
        /// 游戏面板
        /// </summary>
        public GameEntity CreatGameBoard()
        {
            var entity = contexts.game.CreateEntity();
            entity.AddGameGameBoard(8, 9);
            return entity;
        }

        /// <summary>
        /// 游戏物体
        /// </summary>
        public GameEntity CreatBall(int x,int y)
        {
            var entity = contexts.game.CreateEntity();
            entity.isGameMoveable = true;
            entity.isGameGameBoardItem = true;
            entity.AddGameItemIndex(new CustomVector2(x,y));

            return entity;
        }

        /// <summary>
        /// 游戏物体
        /// </summary>
        public void CreatBlocker()
        {

        }


        #endregion

    }
}

